package design.singleton;

/**
 * 静态内部类
 * 此方式可以保证线程安全，并可达到Lazy Loading的目的
 *
 * @Author: zhenzhong.wang
 * @Time: 2018/4/10 16:10
 */
public  class DemoTwo {

  private DemoTwo() {}

  private static class InstanceHolder {
    private static final DemoTwo instance = new DemoTwo();
  }

  public static DemoTwo getInstance() {
    return InstanceHolder.instance;
  }
}
